home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / ANSI.SWG / 0027_ANSI Screen Dump.pas < prev    next >
Pascal/Delphi Source File  |  1994-01-27  |  2KB  |  50 lines

  1. {
  2. From: GREG ESTABROOKS
  3. Subj: ANS->BIN
  4. ---------------------------------------------------------------------------
  5. DT>        I'm looking for some kinda code which will convert an ANSI file
  6. DT> to a raw binary file (<-Or Something that can be directly written to
  7. DT> the screen, without decoding). Something which converts an ansi file, say
  8. DT>24-255 lines to an array which holds <CHAR>,<ATTRIBUTE>,<CHAR>,ect..just
  9. DT>like video memory. Can anybody help me out here?
  10.  
  11.         Just feed the ansi into the CON and then dump the contents of
  12.         video memory to a file. Heres a demo of how to do it.
  13.  
  14.         NOTE: this does not check file IO so if the file doesn't exist
  15.               it'll cause a runtime error.
  16.  
  17.         Call it like this:
  18.              ANSDUMP  AnsiFile DumpFile
  19. }
  20. {***********************************************************************}
  21. PROGRAM AnsiDump;               { Dec 09/93, Greg Estabrooks.           }
  22. USES CRT;                       { IMPORT Clrscr,Writeln                 }
  23. VAR
  24.    Con,                         { File handle to the Console.           }
  25.    InFile :TEXT;                { File that contains ANSI info.         }
  26.    OutFile:FILE;                { File to send new info to.             }
  27.    BuffStr:STRING;              { Holds string read from Ansi File.     }
  28.  
  29. BEGIN
  30.   Clrscr;                       { Clear any screen clutter.             }
  31.   Assign(InFile,ParamStr(1));   { Open Ansi File.                       }
  32.   Reset(InFile);
  33.   Assign(Con,'');               { Assign Con to the Console.            }
  34.   ReWrite(Con);                 { Set it for writing to.                }
  35.   Assign(OutFile,ParamStr(2));  { Open file to send dump to.            }
  36.   ReWrite(OutFile);
  37.   WHILE NOT Eof(InFile) DO      { Loop through entire ansi file.        }
  38.    BEGIN
  39.      Readln(InFile,BuffStr);    { Read line from file.                  }
  40.      Writeln(Con,BuffStr);      { Write line to console.                }
  41.    END;
  42.                                 { Now block write entire contents of text}
  43.                                 { video memory to file.                 }
  44.   BlockWrite(OutFile,MEM[$B800:0000],4000);
  45.   Close(OutFile);               { Close dump file.                      }
  46.   Close(Con);
  47.   Close(InFile);                { Close ansi file.                      }
  48.   Readln;
  49. END.
  50.